<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <jsp:useBean id="calcBean" class="xm.web.bean.CalculatorBean"/>
<jsp:setProperty name="calcBean" property="*"/>
<% calcBean.calculate();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<br/>
计算结果是：
<%=calcBean.getFirstNum() %>
<%=calcBean.getOperator() %>
<%=calcBean.getSecondNum() %>
=
<%=calcBean.getResult() %>
<br/><hr><br/>
<form action="demo2.jsp" method="post">
<table border="1px">
<tr>
<td colspan="2">简单的计算机</td>
</tr>
<tr>
<td>第一个参数</td>
<td><input type="text" name="firstNum"></td>
</tr>
<tr>
<td>运算符</td>
<td><select name="operator">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select></td>
</tr>
<tr>
<td>第二个参数</td>
<td><input type="text" name="secondNum"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="计算"></td>
</tr>
</table>
</form>
</body>
</html>